<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/jquery/jquery-1.7.1.js"></script>
	<link href="${pageContext.request.contextPath}/admin/style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="${pageContext.request.contextPath}/admin/style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/admin/style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="${pageContext.request.contextPath}/admin/scripts/artDialog/artDialog.js?skin=default"></script>

	<title>信息管理系统</title>
	<script type="text/javascript">

		/** 模糊查询  **/
		function search(){
			$("#submitForm").submit();
		}

		/*删除*/
		function del(id){
			$.ajax(
					{
						url:"${pageContext.request.contextPath}/AdminUserManagerServlet?method=deleteUser&uid="+id,
						method:'get',
						success: function(data){
							//alert(data);
							if(data.flag =='true') {
								alert("删除成功")
								window.location.href="${pageContext.request.contextPath}/AdminUserManagerServlet?method=findUsersWithPage"
							}else{
								alert("删除失败")
							}
						},
						error:function(err){
							alert("删除失败");
						}
					});
		}
	</script>
	<style>
		.alt td{ background:black !important;}
	</style>
</head>
<body>
<form id="submitForm" name="submitForm" action="${pageContext.request.contextPath}/AdminUserManagerServlet?method=findUsersWithPage&num=1" method="post">
	<input type="hidden" name="allIDCheck" value="" id="allIDCheck"/>
	<input type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName"/>
	<div id="container">
		<div class="ui_content">
			<div class="ui_text_indent">
				<div id="box_border">
					<div id="box_top" style="background: #9acfea">搜索</div>
					<div id="box_bottom">
						<%--搜索选项--%>
						<label>用户类型:</label>
						<select name="state" class="ui_input_txt02"  style="width:100px;height: 35px;">
							<option value="-1" <c:if test="${searchUser.state == -1}">selected="selected"</c:if> >-所有-</option>
							<option value="0" <c:if test="${searchUser.state == 0}">selected="selected"</c:if> >普通用户</option>
							<option value="1" <c:if test="${searchUser.state == 1}">selected="selected"</c:if> >VIP用户</option>
							<option value="2" <c:if test="${searchUser.state == 2}">selected="selected"</c:if> >管理员</option>
						</select>
							<label>用户名:</label>
						<input type="text" id="fyZldz" name="username" value="${searchUser.username}" class="ui_input_txt02" />
							<label>昵称:</label>
						<input type="text" id="fyZldz" name="name" value="${searchUser.name}" class="ui_input_txt02" />
							<label>邮箱:</label>
						<input type="text" id="fyZldz" name="email" value="${searchUser.email}" class="ui_input_txt02" />
							<label>电话:</label>
						<input type="text" id="fyZldz" name="telephone" value="${searchUser.telephone}" class="ui_input_txt02" />
						<input type="button" value="查询" class="ui_input_btn01" onclick="search();" />
					</div>
				</div>
			</div>
		</div>
		<div class="ui_content">
			<div class="ui_tb">
				<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
					<tr>
						<th>序号</th>
						<th>用户账号</th>
						<th>用户昵称</th>
						<th>邮箱</th>
						<th>手机</th>
						<th>生日</th>
						<th>性别</th>
						<th>等级</th>
						<th>操作</th>
					</tr>
					<c:forEach items="${page.list}" var="user" varStatus="status">
						<tr>
							<td>
									${status.count+page.startIndex}
							</td>
							<td>
									${user.username}
							</td>
							<td>
									${user.name}
							</td>
							<td >
									${user.email}
							</td>
							<td>
									${user.telephone}
							</td>
							<td>
									${user.birthday}
							</td>
							<td>
									${user.sex}
							</td>
							<td>
								<c:if test="${user.state==0}"><span style="color: royalblue">普通用户</span></c:if>
								<c:if test="${user.state==1}"><span style="color: yellow">VIP用户</span></c:if>
								<c:if test="${user.state==2}"><span style="color: red">管理员</span></c:if>
							</td>
							<td>
								<a href="${pageContext.request.contextPath}/AdminUserManagerServlet?method=findUserById&uid=${user.uid}" class="edit">编辑</a>
								<a href="javascript:del('${user.uid}');">删除</a>
							</td>
						</tr>
					</c:forEach>

				</table>
			</div>
			<div >
				<!--分页模块-->
				<%@ include file="/jsp/pageFile2.jsp" %>
			</div>
		</div>
	</div>
</form>
</body>
</html>
